<?php

namespace app\erp\model;

use think\Model;

class Jdpricedb extends Model {
	protected $pk = 'jdprice_id';
	protected $name = 'jdprice';
	protected $type = [ 
			'create_time' => 'timestamp:Y-m-d H:i' 
	];
	// 自动完成时间转换
	protected $autoWriteTimestamp = true;
	public $param = array ();
	public function ajaxSave() {
		$this->allowField ( true )->save ( $this->param );
	}
	public function base($query) {
		$query->where ( 'site_id', SITE_ID );
	}
	public function ajaxList() {
		$data = $this->order ( 'jdprice_id asc' )->where('site_id',SITE_ID)->select ();
		if ($data) {
			return $data->toArray ();
		} else {
			return [ ];
		}
	}
	public function ajaxDelete() {
		$this->destroy ( function ($query) {
			$query->where ( "1=1" );
		}, true );
		return 'success';
	}
}